package com.company.structural.composite_pattern.leaf;

import com.company.structural.composite_pattern.component.AbstractFile;

/**
 * @ClassName ImageFile
 * @Author tiezheng.han
 * @Date 2020/8/31 14:51
 **/
public class ImageFile extends AbstractFile {

    private String name;

    public ImageFile(String name) {
        this.name = name;
    }

    @Override
    public void add(AbstractFile file) {
        System.out.println("对不起不支持该方法");
    }

    @Override
    public void remove(AbstractFile file) {
        System.out.println("对不起不支持该方法");
    }

    @Override
    public AbstractFile getChild(int i) {
        System.out.println("对不起不支持该方法");
        return null;
    }

    @Override
    public void killVirust() {
        //模拟杀毒
        System.out.println("--- 对文本文件‘" + name + "’进行杀毒");
    }

    @Override
    public String toString() {
        return "ImageFile{" +
                "name='" + name + '\'' +
                '}';
    }
}
